#include "Head.h"
#include "indirizzo.h"
#include "pagina.h"
#include "stateMachineTester.h"

int main(void);

void fake_onFailCallBack(void *p);
void fake_onSuccessCallBack(void *p);

void fake_onFailCallBack(void *p){
	void *tmp;
	tmp = p;
}

void fake_onSuccessCallBack(void *p){
	void *tmp = p;
	tmp = p;
}

int main(void){
	int callerId = 1;
	int timeOutData = 2;
	int rxEventData = 3;
	HandShakeMachine machine;
	Event timeoutEvent, rxEvent;

	timeoutEvent.data = (void*)&timeOutData;
	timeoutEvent.signature = HAND_SHAKE_MACHINE_TIMEOUT_EVENT_CODE;

	rxEvent.data = (void*)&rxEventData;
	rxEvent.signature = HAND_SHAKE_MACHINE_RX_EVENT_CODE;
/*
	machine.notifierTarget = (void*)&callerId;
	machine.canPort = NULL;
	machine.paramCheck = 0xffff;
	machine.retryCounter = 0;
	machine.failEnder = fake_onFailCallBack;
	machine.okEnder = fake_onSuccessCallBack;

	stateMachineOnInit((void*) &machine, HandshakeMachineTesterTXsentState);*/
	initTransmission(&machine, NULL, 0x3FFFFFFF, 0, NULL, 0xFFFF, &callerId, fake_onSuccessCallBack, fake_onFailCallBack);
	stateMachineDispatcher((void*) &machine, &timeoutEvent);
	stateMachineDispatcher((void*) &machine, &timeoutEvent);
	stateMachineDispatcher((void*) &machine, &timeoutEvent);
	stateMachineDispatcher((void*) &machine, &timeoutEvent);
	stateMachineDispatcher((void*) &machine, &timeoutEvent);
	stateMachineDispatcher((void*) &machine, &timeoutEvent);
	stateMachineDispatcher((void*) &machine, &timeoutEvent);
	stateMachineDispatcher((void*) &machine, &timeoutEvent);
	stateMachineDispatcher((void*) &machine, &timeoutEvent);
	stateMachineDispatcher((void*) &machine, &timeoutEvent);
	stateMachineOnInit((void*) &machine, HandshakeMachineTesterTXsentState);
	stateMachineDispatcher((void*) &machine, &rxEvent);
	while(1);
}
